package com.future.wxapp.pedometer.controller;

import com.future.wxapp.pedometer.dao.*;
import com.future.wxapp.pedometer.data.Address;
import com.future.wxapp.pedometer.domain.Batches;
import com.future.wxapp.pedometer.domain.Type;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.time.DateFormatUtils;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.junit4.SpringRunner;

import java.util.Date;

/**
 * @author xd
 */
@Slf4j
@RunWith(SpringRunner.class)
@SpringBootTest
public class TestController {
    @Autowired
    private ChickenDao chickenDao;
    @Autowired
    private BatchesDao batchesDao;
    @Autowired
    private TypeDao typeDao;
    @Autowired
    private StepNumberDao stepDao;
    @Autowired
    private SellDao sellDao;
    @Autowired
    private Address address;

    @Test
    public void testSchedule() {
        log.info("当前时间为:{}", DateFormatUtils.format(new Date(), "yyyy-MM-dd HH:mm:ss"));
        //模拟插入数据
        for (Type type : typeDao.selectAll()) {
            Batches batches = new Batches();
            batches.setBirthday(new Date());
            batches.setType(type.getId());
            String addr = address.getRandomAddress();
            batches.setAddress(addr);
            log.info(addr);

        }
    }
}
